import time
import pymysql
import pandas
import re
from datetime import datetime
from selenium import webdriver
from selenium.webdriver import ChromeOptions
settings = {'host': '172.16.10.201', 'user': 'zy001', 'port': 3306, 'password': 'zy@123', 'database': 'crawl', 'charset' :  'utf8'}
conn = pymysql.connect(**settings)
print('##################################################数据库连接成功##################################################')
cursor = conn.cursor()
print('##################################################获取游标成功##################################################')
sql = "insert into 58_rent_all(url,list_url,region,types,create_time) values(%s,%s,%s,%s,%s)"
option = ChromeOptions()

prefs = {
        'profile.default_content_setting_values': {
            'images': 2
        }
    }
# option.headless = True
option.add_experimental_option('prefs', prefs)
option.add_experimental_option('excludeSwitches', ['enable-automation'])
option.add_argument('--ignore-certificate-errors')
driver = webdriver.Chrome(executable_path='chromedriver', options=option)
